<!--#include virtual="/Common/Config.asp" -->
<!--#include virtual="/Common/conn.asp" -->
<!--#include virtual="/Common/Function.asp" -->
<!--#include virtual="/Common/MD5.asp"-->
<%

Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.ContentType="text/html" 

Response.Write User_Login()

Conn_Close()


Function  User_Login() '用户登陆

	UserName = Reform("u")
	password = Request.Form("p")

	If Trim(UserName)="" Then 
		User_Login="0"
		Exit Function 
	End If

	If Trim(password)="" Then 
		User_Login="0"
		Exit Function 
	End If

	password = MD5(password)

	Sql = "SELECT UserID,UserPassword,TrueName,Tel,UserEmail,Member_Type FROM Member  WHERE UserName = '" & UserName & "' "

	rs.open sql,conn

	If rs.EOF And rs.BOF Then
	
		Call conn_close()
		User_Login="0"
		Exit Function 
				
	Else
		
		UserPassword = rs("UserPassword")



		If UserPassword = password Then 

			Session("UserID")	  = rs("UserID") 
			Session("UserName")   = UserName

			Session("TrueName")   = rs("TrueName")
			Session("Tel")	      = rs("Tel")
			Session("UserEmail")  = rs("UserEmail")
			Session("Member_Type")= rs("Member_Type")
			

			Client_IP = get_clientip()

			sql = "UPDATE Member SET Last_LoginDate ='" & Now() & "' ,Last_LoginIP = '" & Client_IP & "',Login_Times = Login_Times+1 WHERE UserName = '" &UserName &"'"

			conn.execute(sql)

			User_Login="1"
			Exit Function 
	
		Else
			User_Login="0"
			Exit Function 
		End If
		

	End If
	
End Function  

%>